<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html
  PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
  <title>CGU - Query - param</title>
  <link rel="stylesheet" type="text/css" href="main.css" />
</head>

<body>

<div id="head">
  <div id="title">
    <h1>CGU</h1>&nbsp;&nbsp;<h2>Common &amp; General Use JavaScript</h2>
  </div>
</div>

<div id="foot">
  <div id="copy">
    <span>&copy; 2008 CGU</span>
  </div>
</div>

<div id="body">
  <div id="nav">
    <div class="pad">
      
      <div class="navlist">
        <h3>CGU</h3>
        <ul>
          <li><a href="index.html">Docs Home</a></li>
          <li><a href="functions.html">Functions</a></li>
        </ul>
      </div>
      
      <div class="navlist">
        <h3>Query</h3>
        <ul>
          <li><a href="function.location.html">location</a></li>
          <li class="active"><a href="function.param.html">param</a></li>
          <li><a href="function.query.html">query</a></li>
          <li><a href="function.serialize.html">serialize</a></li>
        </ul>
      </div>
      
      <div class="navlist">
        <h3>Utilities</h3>
        <ul>
          <li><a href="utility.Cookie.html">Cookie</a></li>
          <li><a href="utility.Crypto.html">Crypto</a></li>
          <li><a href="utility.JSON.html">JSON</a></li>
          <li><a href="utility.Query.html">Query</a></li>
          <li><a href="utility.Time.html">Time</a></li>
          <li><a href="utility.Type.html">Type</a></li>
        </ul>
      </div>
      
    </div>
  </div>
  
  <div id="docs">
    <div class="pad">
      <div id="content">
<!-- Start: Content -->
      
      <h1>Query</h1>
      
      <hr />
      
      <h2>param</h2>
      
      <blockquote>
        <p>Create a query-string from an object's properties.</p>
      </blockquote>
      
      <hr />
      
      <h3>Syntax</h3>
      
      <blockquote>
        <pre class="prettify"><code><span<span class="pln">CGU</span><span class="pun">.</span><span class="pln">param</span><span class="pun">(</span><span class="kwd">object</span><span class="pln"> </span><span class="pun">[,</span><span class="pln"> complete</span><span class="pun">])</span></code></pre>
        
        <blockquote>
          <p><code><b>object</b> &lt;Object&gt;</code>: Object to parameterize.</p>
          <p><code><b>complete</b> &lt;Boolean&gt;</code>: Return a complete search string. <i>(optional)</i></p>
      </blockquote>
      
      <h3>Return</h3>
      
      <blockquote>
        <p><code>&lt;String&gt;</code>: Query-string of an object.</p>
      </blockquote>
      
      <hr />
      
      <h3>Examples</h3>
      
      <blockquote>
        <pre class="prettify"><code><span class="pln">CGU</span><span class="pun">.</span><span class="pln">param</span><span class="pun">({</span><span class="pln">foo</span><span class="pun">:</span><span class="pln"> </span><span class="str">'bar'</span><span class="pun">,</span><span class="pln"> red</span><span class="pun">:</span><span class="pln"> </span><span class="str">'foo'</span><span class="pun">});</span><span class="pln"> &nbsp; &nbsp; &nbsp; &nbsp; </span><span class="com">//=&gt; "foo=bar&amp;red=foo"</span></code></pre>
        <pre class="prettify"><code><span class="pln">CGU</span><span class="pun">.</span><span class="pln">param</span><span class="pun">({</span><span class="pln">foo</span><span class="pun">:</span><span class="pln"> </span><span class="str">'bar'</span><span class="pun">,</span><span class="pln"> red</span><span class="pun">:</span><span class="pln"> </span><span class="str">'foo'</span><span class="pun">},</span><span class="pln"> </span><span class="kwd">true</span><span class="pun">);</span><span class="pln"> &nbsp; </span><span class="com">//=&gt; "?foo=bar&amp;red=foo"</span></code></pre>
        <pre>&nbsp;</pre>
        <pre class="prettify"><code><span class="com">// objects are flattened, keeping the inner-most property name</span></code></pre>
        <pre class="prettify"><code><span class="pln">CGU</span><span class="pun">.</span><span class="pln">param</span><span class="pun">({</span><span class="kwd">nil</span><span class="pun">:</span><span class="pln"> </span><span class="pun">{</span><span class="pln">foo</span><span class="pun">:</span><span class="pln"> </span><span class="str">'bar'</span><span class="pun">},</span><span class="pln"> red</span><span class="pun">:</span><span class="pln"> </span><span class="str">'foo'</span><span class="pun">});</span><span class="pln"> &nbsp;</span><span class="com">//=&gt; "foo=bar&amp;red=foo"</span></code></pre>
        <pre>&nbsp;</pre>
        <pre class="prettify"><code><span class="com">// excludes Function and RegExp Objects</span></code></pre>
        <pre class="prettify"><code><span class="pln">CGU</span><span class="pun">.</span><span class="pln">param</span><span class="pun">({</span><span class="pln">foo</span><span class="pun">:</span><span class="pln"> </span><span class="kwd">function</span><span class="pun">(){},</span><span class="pln"> bar</span><span class="pun">:</span><span class="pln"> </span><span class="str">/pattern/</span><span class="pun">});</span><span class="pln"> &nbsp;</span><span class="com">//=&gt; ""</span></code></pre>
        <pre>&nbsp;</pre>
        <pre class="prettify"><code><span class="pln">CGU</span><span class="pun">.</span><span class="pln">param</span><span class="pun">({</span><span class="pln">foo</span><span class="pun">:</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">Date</span><span class="pun">(</span><span class="lit">2008</span><span class="pun">,</span><span class="pln"> </span><span class="lit">11</span><span class="pun">,</span><span class="pln"> </span><span class="lit">31</span><span class="pun">,</span><span class="pln"> </span><span class="lit">23</span><span class="pun">,</span><span class="pln"> </span><span class="lit">59</span><span class="pun">,</span><span class="pln"> </span><span class="lit">59</span><span class="pun">,</span><span class="pln"> </span><span class="lit">999</span><span class="pun">)});</span><span class="pln"> &nbsp;</span><span class="com">//=&gt; "foo=2008-12-31T23%3A59%3A59.999Z"</span></code></pre>
      </blockquote>
      
      <hr />
      
<!-- Final: Content -->
      </div>
    </div>
  </div>
</div>

  <script type="text/javascript" src="main.js"></script>
</body>

</html>
